package com.gg.star.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gg.entity.Star;
import com.gg.mapper.StarMapper;
import com.gg.povos.FruitStarPovo;

@Service
public class StarService {
	@Autowired
	private  StarMapper  starMapper;
	
	
	public  List<FruitStarPovo>  getStarsByUid(String  uid) {
		
		return    starMapper.selectFruitStarPovoByUid(uid);
		
	}


	public void removeStarBySid(String sid) {
		// TODO Auto-generated method stub
		starMapper.deleteByPrimaryKey(sid);
	}


	public boolean changeScountBySid(String sid,Integer  count) {
		return  starMapper.updateCountBySid(sid,count);
	}


	public boolean verifyFruitIsStar(Integer fid, String uid) {
		
		fid   = starMapper.selectStarByFidAndUid(fid,uid);
		if(fid==null) {
			return   false ;
		}
		return  true ;
	}


	public boolean addStart(Star star) {
		
		return    starMapper.insert(star);
		
	}
	

}
